<template>
<div>
  <el-form>
    <el-form-item  label="管理员名字" prop="name">
      <el-input  label-width="200px" v-model="commodity.adminName"></el-input>
    </el-form-item>
    <el-form-item label="管理员密码" >
      <el-input v-model="commodity.password"></el-input>
    </el-form-item>
    <el-form-item style="margin-top:40px">
      <el-button type="primary" @click="submitForm(commodity)">提交</el-button>
    </el-form-item>
  </el-form>
  </div>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
let { mapActions, mapState } = createNamespacedHelpers("admin");
export default {
  data() {
    return {
      commodity: {
        adminName: "",
        password: "",
      },
    };
  },
  methods: {
    ...mapActions(['addcommodity','addadminacti']),
    submitForm(data) {
      this.addadminacti(data);
      this.open2()
      this.$router.push("/admin/adminIndex/adminPerson");
    },
    open2() {
      this.$message({
        message: "恭喜你,添加成功",
        type: "success"
      });
    }
  }
};
</script>

<style scoped>
div{
    width: 300px;
    margin: 0px auto;
    text-align: center;
}
.cell {
  text-align: center;
}
</style>